<?php
class Application_Form_Register extends Zend_Form{
	public function __construct(){
		parent::__construct(null);
		$this->setName('register');
		$this->setMethod('post');
		
		$name = new Zend_Form_Element_Text('nom');
		$name	->setLabel('Name')
				->setRequired(true)
				->addFilter(new Zend_Filter_StringToLower())
				->addFilter(new Zend_Filter_StringTrim())
				->addFilter(new Zend_Filter_StripTags())
				->addFilter(new Zend_Filter_HtmlEntities())
				->addValidator(new Zend_Validate_NotEmpty())
				->addValidator(new Zend_Validate_StringLength(3));
		$this->addElement($name);
		
		$firstname = new Zend_Form_Element_Text('prenom');
		$firstname	->setLabel('First name')
					->setRequired(true)
					->addFilter(new Zend_Filter_StringToLower())
					->addFilter(new Zend_Filter_StringTrim())
					->addFilter(new Zend_Filter_StripTags())
					->addFilter(new Zend_Filter_HtmlEntities())
					->addValidator(new Zend_Validate_NotEmpty())
					->addValidator(new Zend_Validate_StringLength(3));
		$this->addElement($firstname);
		
		$login = new Zend_Form_Element_Text('login');
		$login	->setLabel('Login')
				->setRequired(true)
				->addFilter('StripTags')
				->addFilter('StringTrim')
				->addValidator('NotEmpty')
				->addValidator(new Zend_Validate_StringLength(4));
		$this->addElement($login);
		
		$password = new Zend_Form_Element_Password('password');
		$password	->setLabel('Password')
					->setRequired(true)
					->addFilter('StripTags')
					->addFilter('StringTrim')
					->addValidator('NotEmpty')
					->addValidator(new Zend_Validate_StringLength(4));
		$this->addElement($password);
		
		$confPass = new Zend_Form_Element_Password('confirm');
		$confPass	->setLabel('Confirm password')
					->setRequired(true)
					->addFilter('StripTags')
					->addFilter('StringTrim')
					->addValidator('NotEmpty')
					->addValidator(new Zend_Validate_StringLength(4))
					->addValidator(new Zend_Validate_Identical('password'));
		$this->addElement($confPass);
		
		$recaptcha = new Zend_Service_ReCaptcha('6LfVQMsSAAAAAKRkO3IsPAh4moQdp5mZ3fEn1EVq', '6LfVQMsSAAAAAMBnxJ7zhvi5lcVqYnAYmzgeVT_j');
		$recaptcha->setOption('theme', 'blackglass');
		$captcha = new Zend_Form_Element_Captcha('captcha', array(
					'captcha'        => 'ReCaptcha',
                    'captchaOptions' => array(
                    		'captcha' => 'ReCaptcha',
                            'service' => $recaptcha
					)
		));
        $this->addElement($captcha);

        $submit = new Zend_Form_Element_Submit('submit');
		$submit	->setLabel('Send');
		$this->addElement($submit);
	}
}